package com.example.back.controller;

import com.example.back.dto.req.DoctorNoticeEditReq;
import com.example.back.dto.req.DoctorNoticeListReq;
import com.example.back.dto.resp.DoctorNoticeListResp;
import com.example.back.service.DoctorNoticeService;
import com.example.common.support.Result;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 信息发布
 */
@RestController
@Api(tags = "信息发布管理")
@RequestMapping("/Message/DoctorNotice")
public class DoctorNoticeController {
    @Resource
    private DoctorNoticeService doctorNoticeService;

    @ApiOperation(value = "获取信息发布列表", notes = "获取信息发布列表")
    @PostMapping(value = "/list")
    public Result<PageInfo<DoctorNoticeListResp>> list(@RequestBody DoctorNoticeListReq req) {
        return Result.success(doctorNoticeService.list(req));
    }

    @ApiOperation(value = "修改和添加信息发布", notes = "修改和添加信息发布")
    @PostMapping(value = "/commitSave")
    public Result<Object> commitSave(@RequestBody DoctorNoticeEditReq req) {
        return Result.success(doctorNoticeService.commitSave(req));
    }

    @ApiOperation(value = "删除信息发布", notes = "删除信息发布")
    @PostMapping(value = "/commitDel")
    public Result<Object> commitDel(@RequestBody DoctorNoticeEditReq req) {
        return Result.success(doctorNoticeService.commitDel(req));
    }
}
